#ifndef __SCNS_WAV_H__
#define __SCNS_WAV_H__

#include "ScnsConfig.h"

#if defined(SCNS_WAV_ENABLE)&&SCNS_WAV_ENABLE==1

#include "ScnsYing.h"

typedef struct
{
    uint8 numChannels;
    uint8 bitsPerSample;
    uint32 sampleRate;
}ScnsWavInfo;

typedef struct
{
    ScnsWavInfo info;
    uint32 len;
    uint8 data[];
}ScnsWav;

#include "ScnsWav.table.h"

extern uint8 scnsWavInfoIsSame(const ScnsWavInfo*a,const ScnsWavInfo*b);
#if defined(SCNS_MALLOC_ENABLE)&&SCNS_MALLOC_ENABLE==1

#include "ScnsMalloc.h"

extern ScnsWav*scnsWavNew(ScnsMallocEnum malN,uint32 dataSizeInByte);
extern ScnsWav*scnsWavFree(ScnsWav*this);
extern ScnsWav*scnsWavGenerate(ScnsMallocEnum malN,int frequency,int sampleRate,int numChannels,int bitsPerSample,float duration);
#if defined(SCNS_FILE_ENABLE)&&SCNS_FILE_ENABLE==1
extern void scnsWavPrint(const ScnsWav*wav,FILE*fp,uint8 printData,const char name[]);
extern ScnsWav*scnsWavRead(FILE*fp,uint8 close,ScnsMallocEnum malN);
extern void scnsWavWrite(const ScnsWav*wav,FILE*fp,uint8 close);
#endif
#endif
#endif
#endif
